package com.flowershop.listener;

import com.flowershop.util.DatabaseInitializer;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.ServletContextEvent;
import jakarta.servlet.annotation.WebListener;

@WebListener
public class DatabaseInitListener implements ServletContextListener {
    
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("Initializing database...");
        DatabaseInitializer.initDatabase();
    }
    
    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        // 清理工作（如果需要）
    }
} 